home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / Interfaces / CIncludes / Printing.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-30  |  10.1 KB  |  358 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Tuesday, October 4, 1988 at 7:29 PM
  4.     Printing.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.  1985-1988
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PRINTING__
  15. #define __PRINTING__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21. #ifndef __DIALOGS__
  22. #include <Dialogs.h>
  23. #endif
  24.  
  25. #define iPFMaxPgs 128
  26. #define iPrPgFract 120              /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  27. #define iPrPgFst 1                  /*Page range constants*/
  28. #define iPrPgMax 9999
  29. #define iPrRelease 3                /*Current version number of the code.*/
  30. #define iPrSavPFil -1
  31. #define iPrAbort 0x0080
  32. #define iPrDevCtl 7                 /*The PrDevCtl Proc's ctl number*/
  33. #define lPrReset 0x00010000         /*The PrDevCtl Proc's CParam for reset*/
  34. #define lPrLineFeed 0x00030000
  35. #define lPrLFStd 0x0003FFFF         /*The PrDevCtl Proc's CParam for std paper advance*/
  36. #define lPrLFSixth 0x0003FFFF
  37. #define lPrPageEnd 0x00020000       /*The PrDevCtl Proc's CParam for end page*/
  38. #define lPrDocOpen 0x00010000
  39. #define lPrPageOpen 0x00040000
  40. #define lPrPageClose 0x00020000
  41. #define lPrDocClose 0x00050000
  42. #define iFMgrCtl 8                  /*The FMgr's Tail-hook Proc's ctl number*/
  43. #define iMemFullErr -108
  44. #define iIOAbort -27
  45. #define pPrGlobals 0x00000944       /*The PrVars lo mem area:*/
  46. #define bDraftLoop 0
  47. #define bSpoolLoop 1
  48. #define bUser1Loop 2
  49. #define bUser2Loop 3
  50. #define iPrBitsCtl 4
  51. #define lScreenBits 0
  52. #define lPaintBits 1
  53. #define lHiScreenBits 0x00000002    /*The Bitmap Print Proc's Screen Bitmap param*/
  54. #define lHiPaintBits 0x00000003     /*The Bitmap Print Proc's Paint [sq pix] param*/
  55. #define iPrIOCtl 5
  56. #define iPrEvtCtl 6                 /*The PrEvent Proc's ctl number*/
  57. #define lPrEvtAll 0x0002FFFD        /*The PrEvent Proc's CParam for the entire screen*/
  58. #define lPrEvtTop 0x0001FFFD        /*The PrEvent Proc's CParam for the top folder*/
  59. #define sPrDrvr ".Print"
  60. #define iPrDrvrRef -3
  61. #define getRslDataOp 4
  62. #define setRslOp 5
  63. #define draftBitsOp 6
  64. #define noDraftBitsOp 7
  65. #define getRotnOp 8
  66. #define NoSuchRsl 1
  67. #define RgType1 1
  68.  
  69. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  70. typedef unsigned char TFeed;
  71.  
  72. enum {scanTB,scanBT,scanLR,scanRL};
  73. typedef unsigned char TScan;
  74.  
  75. typedef Rect *TPRect;
  76.  
  77. typedef pascal void (*PrIdleProcPtr)(void);
  78. typedef pascal short (*PItemProcPtr)(DialogPtr theDialog, short item);
  79.  
  80. struct TPrPort {
  81.     GrafPort gPort;                 /*The Printer's graf port.*/
  82.     QDProcs gProcs;                 /*..and its procs*/
  83.     long lGParam1;                  /*16 bytes for private parameter storage.*/
  84.     long lGParam2;
  85.     long lGParam3;
  86.     long lGParam4;
  87.     Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  88.     Boolean fOurBits;               /*Whether the BitMap allocation was done by us.*/
  89. };
  90.  
  91. #ifndef __cplusplus
  92. typedef struct TPrPort TPrPort;
  93. #endif
  94.  
  95. typedef TPrPort *TPPrPort;
  96.  
  97. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  98. This is the "PrPeek" record.
  99.  */
  100. struct TPrInfo {
  101.     short iDev;                     /*Font mgr/QuickDraw device code*/
  102.     short iVRes;                    /*Resolution of device, in device coordinates*/
  103.     short iHRes;                    /*..note: V before H => compatable with Point.*/
  104.     Rect rPage;                     /*The page (printable) rectangle in device coordinates.*/
  105. };
  106.  
  107. #ifndef __cplusplus
  108. typedef struct TPrInfo TPrInfo;
  109. #endif
  110.  
  111. typedef TPrInfo *TPPrInfo;
  112.  
  113. /* Print Info Record: The parameters needed for page composition. */
  114. struct TPrStl {
  115.     short wDev;
  116.     short iPageV;
  117.     short iPageH;
  118.     char bPort;
  119.     TFeed feed;
  120. };
  121.  
  122. #ifndef __cplusplus
  123. typedef struct TPrStl TPrStl;
  124. #endif
  125.  
  126. typedef TPrStl *TPPrStl;
  127.  
  128. struct TPrXInfo {
  129.     short iRowBytes;
  130.     short iBandV;
  131.     short iBandH;
  132.     short iDevBytes;
  133.     short iBands;
  134.     char bPatScale;
  135.     char bUlThick;
  136.     char bUlOffset;
  137.     char bUlShadow;
  138.     TScan scan;
  139.     char bXInfoX;
  140. };
  141.  
  142. #ifndef __cplusplus
  143. typedef struct TPrXInfo TPrXInfo;
  144. #endif
  145.  
  146. typedef TPrXInfo *TPPrXInfo;
  147.  
  148. struct TPrJob {
  149.     short iFstPage;                 /*Page Range.*/
  150.     short iLstPage;
  151.     short iCopies;                  /*No. copies.*/
  152.     char bJDocLoop;                 /*The Doc style: Draft, Spool, .., and ..*/
  153.     Boolean fFromUsr;               /*Printing from an User's App (not PrApp) flag*/
  154.     PrIdleProcPtr pIdleProc;        /*The Proc called while waiting on IO etc.*/
  155.     StringPtr pFileName;            /*Spool File Name: NIL for default.*/
  156.     short iFileVol;                 /*Spool File vol, set to 0 initially*/
  157.     char bFileVers;                 /*Spool File version, set to 0 initially*/
  158.     char bJobX;                     /*An eXtra byte.*/
  159. };
  160.  
  161. #ifndef __cplusplus
  162. typedef struct TPrJob TPrJob;
  163. #endif
  164.  
  165. typedef TPrJob *TPPrJob;
  166.  
  167. /* Print Job: Print "form" for a single print request. */
  168. struct TPrint {
  169.     short iPrVersion;               /*(2) Printing software version*/
  170.     TPrInfo prInfo;                 /*(14) the PrInfo data associated with the current style.*/
  171.     Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  172.     TPrStl prStl;                   /*(8)  This print request's style.*/
  173.     TPrInfo prInfoPT;               /*(14)  Print Time Imaging metrics*/
  174.     TPrXInfo prXInfo;               /*(16)  Print-time (expanded) Print info record.*/
  175.     TPrJob prJob;                   /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  176.     short printX[19];               /*Spare to fill to 120 bytes!*/
  177. };
  178.  
  179. #ifndef __cplusplus
  180. typedef struct TPrint TPrint;
  181. #endif
  182.  
  183. typedef TPrint *TPPrint, **THPrint;
  184.  
  185. /* The universal 120 byte printing record */
  186. struct TPrStatus {
  187.     short iTotPages;                /*Total pages in Print File.*/
  188.     short iCurPage;                 /*Current page number*/
  189.     short iTotCopies;               /*Total copies requested*/
  190.     short iCurCopy;                 /*Current copy number*/
  191.     short iTotBands;                /*Total bands per page.*/
  192.     short iCurBand;                 /*Current band number*/
  193.     Boolean fPgDirty;               /*True if current page has been written to.*/
  194.     Boolean fImaging;               /*Set while in band's DrawPic call.*/
  195.     THPrint hPrint;                 /*Handle to the active Printer record*/
  196.     TPPrPort pPrPort;               /*Ptr to the active PrPort*/
  197.     PicHandle hPic;                 /*Handle to the active Picture*/
  198. };
  199.  
  200. #ifndef __cplusplus
  201. typedef struct TPrStatus TPrStatus;
  202. #endif
  203.  
  204. typedef TPrStatus *TPPrStatus;
  205.  
  206. /* Print Status: Print information during printing. */
  207. struct TPfPgDir {
  208.     short iPages;
  209.     long iPgPos[129];               /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  210. };
  211.  
  212. #ifndef __cplusplus
  213. typedef struct TPfPgDir TPfPgDir;
  214. #endif
  215.  
  216. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  217.  
  218. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  219. struct TPrDlg {
  220.     DialogRecord Dlg;               /*The Dialog window*/
  221.     ModalFilterProcPtr pFltrProc;   /*The Filter Proc.*/
  222.     PItemProcPtr pItemProc;         /*The Item evaluating proc.*/
  223.     THPrint hPrintUsr;              /*The user's print record.*/
  224.     Boolean fDoIt;
  225.     Boolean fDone;
  226.     long lUser1;                    /*Four longs for user's to hang global data.*/
  227.     long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  228.     long lUser3;
  229.     long lUser4;
  230. };
  231.  
  232. #ifndef __cplusplus
  233. typedef struct TPrDlg TPrDlg;
  234. #endif
  235.  
  236. typedef TPrDlg *TPPrDlg;
  237.  
  238. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  239.  
  240. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  241. Print Dialog: The Dialog Stream object. */
  242.  
  243.  
  244. struct TGnlData {
  245.     short iOpCode;
  246.     short iError;
  247.     long lReserved;                 /*more fields here depending on call*/
  248. };
  249.  
  250. #ifndef __cplusplus
  251. typedef struct TGnlData TGnlData;
  252. #endif
  253.  
  254. struct TRslRg {
  255.     short iMin;
  256.     short iMax;
  257. };
  258.  
  259. #ifndef __cplusplus
  260. typedef struct TRslRg TRslRg;
  261. #endif
  262.  
  263. struct TRslRec {
  264.     short iXRsl;
  265.     short iYRsl;
  266. };
  267.  
  268. #ifndef __cplusplus
  269. typedef struct TRslRec TRslRec;
  270. #endif
  271.  
  272. struct TGetRslBlk {
  273.     short iOpCode;
  274.     short iError;
  275.     long lReserved;
  276.     short iRgType;
  277.     TRslRg xRslRg;
  278.     TRslRg yRslRg;
  279.     short iRslRecCnt;
  280.     TRslRec rgRslRec[27];
  281. };
  282.  
  283. #ifndef __cplusplus
  284. typedef struct TGetRslBlk TGetRslBlk;
  285. #endif
  286.  
  287. struct TSetRslBlk {
  288.     short iOpCode;
  289.     short iError;
  290.     long lReserved;
  291.     THPrint hPrint;
  292.     short iXRsl;
  293.     short iYRsl;
  294. };
  295.  
  296. #ifndef __cplusplus
  297. typedef struct TSetRslBlk TSetRslBlk;
  298. #endif
  299.  
  300. struct TDftBitsBlk {
  301.     short iOpCode;
  302.     short iError;
  303.     long lReserved;
  304.     THPrint hPrint;
  305. };
  306.  
  307. #ifndef __cplusplus
  308. typedef struct TDftBitsBlk TDftBitsBlk;
  309. #endif
  310.  
  311. struct TGetRotnBlk {
  312.     short iOpCode;
  313.     short iError;
  314.     long lReserved;
  315.     THPrint hPrint;
  316.     Boolean fLandscape;
  317.     char bXtra;
  318. };
  319.  
  320. #ifndef __cplusplus
  321. typedef struct TGetRotnBlk TGetRotnBlk;
  322. #endif
  323.  
  324. #ifdef __safe_link
  325. extern "C" {
  326. #endif
  327. pascal void PrPurge(void); 
  328. pascal void PrNoPurge(void); 
  329. pascal void PrOpen(void); 
  330. pascal void PrClose(void); 
  331. pascal void PrintDefault(THPrint hPrint); 
  332. pascal Boolean PrValidate(THPrint hPrint); 
  333. pascal Boolean PrStlDialog(THPrint hPrint); 
  334. pascal Boolean PrJobDialog(THPrint hPrint); 
  335. pascal TPPrDlg PrStlInit(THPrint hPrint); 
  336. pascal TPPrDlg PrJobInit(THPrint hPrint); 
  337. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst); 
  338. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit); 
  339. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf); 
  340. pascal void PrCloseDoc(TPPrPort pPrPort); 
  341. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame); 
  342. pascal void PrClosePage(TPPrPort pPrPort); 
  343. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  344.     TPrStatus *prStatus); 
  345. pascal short PrError(void); 
  346. pascal void PrSetError(short iErr); 
  347. pascal void PrGeneral(Ptr pData); 
  348. pascal void PrDrvrOpen(void); 
  349. pascal void PrDrvrClose(void); 
  350. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3); 
  351. pascal Handle PrDrvrDCE(void); 
  352. pascal short PrDrvrVers(void); 
  353. #ifdef __safe_link
  354. }
  355. #endif
  356.  
  357. #endif
  358.